﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Resources;      // StreamResourceInfo
using System.Windows.Media.Imaging;  // BitmapImage

namespace DBSchemaViewer.FrontEnd.Main.Helpers
{
    public static class ResourceHelper
    {
        public static BitmapImage LoadImageFromResourceFolderContent(string imageName)
        {
            StreamResourceInfo sr = Application.GetResourceStream(
                new Uri("Resources/" + imageName, UriKind.Relative));

            BitmapImage bmp = new BitmapImage();
            bmp.SetSource(sr.Stream);

            // sr.Stream.Close()??

            return bmp;
        }

    }
}
